<template>
	<div class="store">
		<div class="store-head-img">
			<div class="store-head-box" style="background-image: url('https://ss1.baidu.com/-4o3dSag_xI4khGko9WTAnF6hhy/image/h%3D300/sign=5c1f0d3c4b34970a5873162fa5cbd1c0/d043ad4bd11373f076ceaa8cae0f4bfbfbed0434.jpg');">
				<div class="store-head">
					<i class="iconfont icon-left" @click="goBack"></i>
					<input type="text" class="keyword" id="keyword" placeholder="测试商品名称" v-model="keyword" />
					<div class="classify">
						<i class="iconfont icon-menu"></i>
						<p>商品</p>
					</div>
				</div>
				<div class="store-info">
					<div class="store-box">
						<img :src="storeInfo.store_logo" class="store-logo" />
						<div class="name">
							<p>{{storeInfo.store_name}}</p>
							<p>店铺QQ：{{storeInfo.store_qq}}</p>
						</div>
					</div>
					<!--<div class="store-fans">
						<span :class="{'active': isGuanzhu}" @click="handleChangeIsGuanzhu">
							<i class="iconfont icon-guanzhu"></i>
							{{isGuanzhu ? '已关注' : '关注'}}
						</span>
					</div>-->
				</div>
			</div>
			<div class="store-classify-nav">
				<div class="store-classify-item" @click="handleChangeNav(item.id)" v-for="item in storeClassify" :key="item.id" :class="{'active': item.id == activeId}">
					{{item.name}}
				</div>
			</div>
		</div>
		<div class="store-classify">
			<mt-tab-container v-model="activeId">
				<mt-tab-container-item id="1">
					<img v-for="n in [1,2,3,4]" :key="n" src="https://ss1.baidu.com/-4o3dSag_xI4khGko9WTAnF6hhy/image/h%3D300/sign=5c1f0d3c4b34970a5873162fa5cbd1c0/d043ad4bd11373f076ceaa8cae0f4bfbfbed0434.jpg" />
				</mt-tab-container-item>
				<mt-tab-container-item id="2">
					<productlist :list="productList"></productlist>
				</mt-tab-container-item>
			</mt-tab-container>
		</div>
	</div>
</template>

<script>
	import productlist from '../Sub/ProductList';
	export default {
		name: 'store',
		data() {
			return {
				storeId: '',
				keyword: '',
				activeId: '1',
				storeInfo: {},
				isGuanzhu: false,
				storeClassify: [{
					name: '首页',
					id: '1'
				}, {
					name: '全部宝贝',
					id: '2'
				}],
				productList: []
			}
		},
		methods: {
			goBack() {
				history.go(-1);
			},
			getStoreInfo() {
				this.$http.post('/moblieorderbuyer/buyer/store_info.htm', {
					store_id: this.$route.query.storeId
				}).then(res => {
					if(res.code == 0) {
						this.storeInfo = res.data;
					}
				})
			},
			handleChangeNav(idx) {
				this.activeId = idx;
			},
			handleChangeIsGuanzhu() {
				this.isGuanzhu = !this.isGuanzhu;
			}
		},
		components: {
			productlist
		},
		created() {
			this.getStoreInfo();
		}
	}
</script>

<style lang="less">
	.store {
		padding-top: 3rem;
		.store-head-box {
			height: 2rem;
			background-size: cover;
		}
		.store-head-img {
			font-size: 0.24rem;
			height: 3rem;
			position: fixed;
			top: 0;
			left: 0;
			right: 0;
			z-index: 10;
			.store-head {
				height: 1rem;
				display: flex;
				align-items: center;
				padding: 0 0.3rem;
				&>.iconfont {
					color: #FFFFFF;
					margin-right: 0.3rem;
				}
				.keyword {
					text-indent: 0.24rem;
					border: none;
					background-color: #FFFFFF;
					height: 0.6rem;
					border-radius: 0.4rem;
					width: 80%;
				}
				.classify {
					margin-right: 0;
					margin-left: 0.3rem;
					color: #FFFFFF;
					text-align: center;
					width: 0.5rem;
				}
			}
		}
		.store-info {
			display: flex;
			height: 1rem;
			align-items: center;
			justify-content: space-between;
			padding: 0 0.3rem;
			.store-box {
				display: flex;
				align-items: center;
				color: #FFFFFF;
				img {
					margin-right: 0.2rem;
				}
			}
			.store-fans {
				color: #FFFFFF;
				text-align: right;
				span {
					display: flex;
					width: 1.25rem;
					height: 0.5rem;
					justify-content: center;
					align-items: center;
					border: 1px solid #FFFFFF;
					padding: 2px 6px;
					border-radius: 6px;
					.iconfont {
						margin-right: 0.1rem;
					}
					&.active {
						border-color: #E4393C;
						color: #E4393C;
						background-color: #FFFFFF;
						.iconfont {
							color: #E4393C;
						}
					}
				}
			}
		}
		.store-classify-nav {
			display: flex;
			height: 1rem;
			line-height: calc(~'1rem - 2px');
			align-items: center;
			background-color: #FFFFFF;
			.store-classify-item {
				flex: 1;
				text-align: center;
				border-bottom: 2px solid transparent;
				&.active {
					border-color: #E4393C;
				}
			}
		}
	}
</style>